<?php
defined('_JEXEC') or die;
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :

?>
<ul class="subCatLink">
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
	<?php
	if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
	?>   	
        <li><a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id));?>">
			<?php echo $this->escape($item->title); ?>
            </a>
            <?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
			<span>(<?php echo $item->numitems; ?>)</span><?php endif; ?>
            
        <?php if (count($item->getChildren()) > 0) :
			$this->items[$item->id] = $item->getChildren();
			$this->parent = $item;
			$this->maxLevelcat--;
			echo $this->loadTemplate('sublink');
			$this->parent = $item->getParent();
			$this->maxLevelcat++;
		endif; ?>   
	
		</li>
        	
	<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>